(function(){"use strict";BX.namespace("BX.Landing");var i={quality:.8};var t=BX.Landing.Utils.urlToBlob;var n=BX.Landing.Utils.fileSize;var e=BX.Landing.Utils.isPlainObject;var o=BX.Landing.Utils.isNumber;BX.Landing.ImageCompressor=function(t,n){this.file=t;this.options=Object.assign({},i,s(n)||{});if(this.options.retina){void(o(this.options.width)&&(this.options.width*=2));void(o(this.options.height)&&(this.options.height*=2));void(o(this.options.maxWidth)&&(this.options.maxWidth*=2));void(o(this.options.maxHeight)&&(this.options.maxHeight*=2));void(o(this.options.minWidth)&&(this.options.minWidth*=2));void(o(this.options.minHeight)&&(this.options.minHeight*=2))}};function s(i){i=e(i)?i:{};return Object.keys(i).reduce(function(t,n){return typeof i[n]!=="undefined"&&(t[n]=i[n]),t},{})}function r(i){var t=n(i.before);var e=n(i.after);var o=i.quality;var s=i.retina?"@2x":"";console.info("Image compressed",t,"�>",e,"(quality "+o*100+"%)",s)}BX.Landing.ImageCompressor.compress=function(i,n){return t(i).then(function(i){var t=new BX.Landing.ImageCompressor(i,n);return t.compress().then(function(n){r({before:i.size,after:n.size,quality:t.options.quality,retina:t.options.retina});return n})})};BX.Landing.ImageCompressor.test=function(i,e){var o={before:0,after:0,printable:{before:"0 B",after:"0 B"}};return t(i).then(function(i){return new BX.Landing.ImageCompressor(i,e).compress().then(function(t){o.before=i.size;o.after=t.size;o.printable.before=n(i.size);o.printable.after=n(t.size);return o})})};BX.Landing.ImageCompressor.prototype={compress:function(){var i=this.file;var t=this.options;return new Promise(function(n,e){void new Compressor(i,Object.assign({},t,{success:n,error:e}))})}}})();
//# sourceMappingURL=compressor.map.js